package com.quanyan.api;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @author songzj
 * @date 16/4/14-18:33
 */
public class APIRequest<T> implements Serializable{


    private static final long serialVersionUID = -8626066276225990603L;

    private String plat; //请求平台.

    private String channel ; //渠道

    private String token; //用户唯一标识

    private String sign ; //签名.

    private String ver; //版本号.

    private Integer protocal_ver; //协议版本号. 兼容C++端. Java端不使用版本号控制.

    @Valid
    @NotNull
    private T data; //请求参数

    public String getPlat() {
        return plat;
    }

    public void setPlat(String plat) {
        this.plat = plat;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public String getVer() {
        return ver;
    }

    public void setVer(String ver) {
        this.ver = ver;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getChannel() {
        return channel;
    }

    public void setChannel(String channel) {
        this.channel = channel;
    }


    public Integer getProtocal_ver() {
        return protocal_ver;
    }

    public void setProtocal_ver(Integer protocal_ver) {
        this.protocal_ver = protocal_ver;
    }

    @Override
    public String toString() {
        return "{" +
                "\"plat\":'" + plat + '\'' +
                ", \"channel\":'" + channel + '\'' +
                ", \"token\":'" + token + '\'' +
                ", \"sign\":'" + sign + '\'' +
                ", \"ver\":'" + ver + '\'' +
                ", \"protocal_ver\":" + protocal_ver +
                ", \"data\":" + data +
                '}';
    }
}
